import { createRouter, createWebHashHistory } from 'vue-router'
import routes from './routes'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
const router = createRouter({
  history: createWebHashHistory(),
  routes
})
router.beforeEach((to, from, next) => { 
  console.log('to', to)
  console.log('from', from)
  if (to.meta.title) { 
    document.title = to.meta.title as string
  }
    NProgress.start();
    next();
})
router.afterEach(() => { 
    NProgress.done();
})
export default router